package cn.iocoder.yudao.module.system.enums.merchant;

import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.mapstruct.Mapper;

import java.util.Arrays;


@Getter
@AllArgsConstructor
public enum MerchantIdentity implements IntArrayValuable {
    COMMON(0, "个人农产品商户"),
    BUSINESS(1, "企业农产品商户"),
    FACTORY(2, "加工厂商家");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(MerchantIdentity::getType).toArray();

    private final Integer type;

    private final String name;

    public static String getName(Integer type) {
        for(MerchantIdentity item : MerchantIdentity.values()){
            if(item.getType().equals(type)){
                return item.getName();
            }
        }
        return null;
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
